package com.xianyun.book.service;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.xianyun.book.api.OrderServiceI;
import com.xianyun.book.command.BookIdleRefreshCmdExe;
import com.xianyun.book.command.BookPurchaseCmdExe;
import com.xianyun.book.command.BookSellAddCmdExe;
import com.xianyun.book.dto.BookIdleRefreshCmd;
import com.xianyun.book.dto.BookPurchaseCmd;
import com.xianyun.book.dto.BookSellAddCmd;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * 订单服务
 * @author ytt
 */
@CatchAndLog
@Service
public class OrderServiceImpl implements OrderServiceI {

    @Resource
    private BookSellAddCmdExe bookSellAddCmdExe;

    @Resource
    private BookIdleRefreshCmdExe idleRefreshCmdExe;

    @Resource
    private BookPurchaseCmdExe bookPurchaseCmdExe;

    @Override
    public Response postIdle(BookSellAddCmd sellAddCmd) {
        return bookSellAddCmdExe.execute(sellAddCmd);
    }

    @Override
    public Response refreshIdle(BookIdleRefreshCmd refreshCmd) {
        return idleRefreshCmdExe.execute(refreshCmd);
    }

    @Override
    public SingleResponse<String> purchaseBook(BookPurchaseCmd purchaseCmd) {
        return bookPurchaseCmdExe.execute(purchaseCmd);
    }
}
